package autoorder.zsxmlv.action;

import autoorder.zsxmlv.po.Goods;
import autoorder.zsxmlv.service.GoodsService;
import common.zsxmlv.vo.Result;
import common.zsxmlv.vo.Table;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: ZSXM
 * @Description:
 * @Company: DingZheng
 * @Date: Create by 2018/6/2 22:22
 * @Version: 1.0
 * @Modify by:
 */
@Controller
@ResponseBody
@RequestMapping("/admin/auto_order/goods")
public class GoodsAction {

    @Resource
    private GoodsService goodsService;

    @RequestMapping("/updateGoodsStatusByGoodsId")
    public Result updateGoodsStatusByGoodsId(String goodsId){
        return goodsService.updateGoodsStatusByGoodsId(goodsId);
    }

    @RequestMapping("/updateGoodsStatus")
    public Result updateGoodsStatus(Integer type, String ids) {
        return goodsService.updateGoodsStatus(ids, type);
    }

    @RequestMapping("/selectByPage")
    public Table selectByPage(Integer page, Integer limit, String goodsName, Integer status, Integer shopId){
        return goodsService.selectByPage(page, limit, goodsName, status, shopId);
    }

    @RequestMapping("/getGoodsListByNetwork")
    public Result getGoodsListByNetwork(Integer shopId){
        return goodsService.getGoodsListByNetwork(shopId);
    }

    @RequestMapping("/listGoodsByStatus")
    public List<Goods> listAllGoodsByStatus(Integer status) {
        return goodsService.listAllGoodsByStatus(status);
    }

}
